using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FiltronASP.Modules.Abstracts;
using FiltronASP.Models.DAO.Interfaces;
using System.Web.UI.WebControls;
using FiltronASP.Models;
using FiltronASP.Models.DAO.Filtron;
using FiltronASP.Helpers.CatalogueMenu;
using FiltronASP.Helpers.Translations;
using FiltronASP.Consts;
using System.Text;

namespace FiltronASP.Modules
{
    public class passengerCarsSearchModuleFiltron : AbstractModule
    {
        private Page currentPage;

        /// <summary>
        /// Klasa odpowiedzialna za generowanie contentu przez modul.
        /// </summary>
        /// <param name="page">biezaca strona</param>
        /// <returns>content</returns>
        public override string GenerateContent(FiltronASP.Models.Page page)
        {
            this.currentPage = page;
            int languageId = Convert.ToInt32(page.language_id);
            int pageId = page.page_id;
            return this.generateBottomMenu(languageId, pageId);
        }

        private string generateBottomMenu(int languageId, int pageId)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<div class='col-xs-12 no-padding localization '>");
            sb.Append(String.Format("<p class='text-right' style='text-align: left; float: left; width: 50%'>{2}: <a style='color: #fcb320;' href='{0}'>{3} </a>/<a href='{1}'> {4}</a></p>", translationHelper.getTranslation("_mainSearchFiltronPassenger", languageId), translationHelper.getTranslation("_mainSearchWixPassenger", languageId), translationHelper.getTranslation("_localization", languageId), translationHelper.getTranslation("_mainSearchLocalizationEU", languageId), translationHelper.getTranslation("_mainSearchLocalizationUS", languageId)));
            sb.Append(CatalogueMenuHelper.GenerateLastModifiedFiltron(this.currentPage.language_id));
            sb.Append("</div>");
            sb.Append("<div class='col-xs-12 line-bottom-pading'>");

            sb.Append("<div class='col-md-4 col-sm-6 col-xs-12 no-padding'>");

            sb.Append(String.Format("<a href='{0}'>", translationHelper.getTranslation("_mainSearchFiltronPassenger", languageId)));
            string activeClass = String.Empty;
            if (GlobalConsts.PASSENGER_PAGE_IDS.Contains(pageId))
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-passenger pas-back-2 wow fadeInLeft'>");
                activeClass = "car-item-name-active";
            }   //if
            else
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-passenger pas-back-1 wow fadeInLeft'>");
            }   //else
            sb.Append("<div class='category-select  '>");
            sb.Append(String.Format("<p class='car-item-name {0}'>{1}</p>", activeClass, translationHelper.getTranslation("_mainSearchPassengerText", languageId)));
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("</a>");

            sb.Append(String.Format("<a href='{0}'>", translationHelper.getTranslation("_mainSearchFiltronTruck", languageId)));
            activeClass = String.Empty;
            if (GlobalConsts.TRUCK_BUS_PAGE_IDS.Contains(pageId))
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-truck truck-back-2 wow fadeInLeft'>");
                activeClass = "car-item-name-active";
            }   //if
            else
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-truck truck-back-1 wow fadeInLeft'>");
            }   //else
            sb.Append("<div class='category-select  '>");
            sb.Append(String.Format("<p class='car-item-name {0}'>{1}</p>", activeClass, translationHelper.getTranslation("_mainSearchTruckText", languageId)));
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("</a>");

            sb.Append(String.Format("<a href='{0}'>", translationHelper.getTranslation("_mainSearchFiltronMachines", languageId)));
            activeClass = String.Empty;
            if (GlobalConsts.OFF_HIGHWAY_IDS.Contains(pageId))
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-machine machine-back-2 wow fadeInLeft '>");
                activeClass = "car-item-name-active";
            }   //if
            else
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-machine machine-back-1 wow fadeInLeft '>");
            }   //else
            sb.Append("<div class='category-select  '>");
            sb.Append(String.Format("<p class='car-item-name {0}'>{1}</p>", activeClass, translationHelper.getTranslation("_mainSearchMachineText", languageId)));
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("</a>");

            sb.Append("</div>");

            sb.Append("<div class='col-md-4 col-sm-6 col-xs-12 no-padding'>");

            sb.Append(String.Format("<a href='{0}'>", translationHelper.getTranslation("_mainSearchFiltronOther", languageId)));
            activeClass = String.Empty;
            if (GlobalConsts.LIGHT_AND_OTHER_MACHINES_IDS.Contains(pageId))
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-light light-back-2 wow fadeInDown '>");
                activeClass = "car-item-name-active";
            }   //if
            else
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-light light-back-1 wow fadeInDown '>");
            }   //else
            sb.Append("<div class='category-select'>");
            sb.Append(String.Format("<p class='car-item-name {0} two-line'>{1}</p>", activeClass, translationHelper.getTranslation("_mainSearchOtherText", languageId)));
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("</a>");

            sb.Append(String.Format("<a href='{0}'>", translationHelper.getTranslation("_mainSearchFiltronMotorcycle", languageId)));

            activeClass = String.Empty;
            if (GlobalConsts.MOTOR_IDS.Contains(pageId))
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-motorcycles motorcycles-back-2 wow fadeInDown '>");
                activeClass = "car-item-name-active";
            }   //if
            else
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-motorcycles motorcycles-back-1 wow fadeInDown '>");
            }   //else
            sb.Append("<div class='category-select  '>");
            sb.Append(String.Format("<p class='car-item-name {0}'>{1}</p>", activeClass, translationHelper.getTranslation("_mainSearchMotorcyclesText", languageId)));
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("</a>");

            sb.Append(String.Format("<a href='{0}'>", translationHelper.getTranslation("_mainSearchFiltronQuad", languageId)));
            activeClass = String.Empty;
            if (GlobalConsts.QUAD_IDS.Contains(pageId))
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-atv atv-back-2 wow fadeInDown '>");
                activeClass = "car-item-name-active";
            }   //if
            else
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-atv atv-back-1 wow fadeInDown '>");
            }   //else
            sb.Append("<div class='category-select  '>");
            sb.Append(String.Format("<p class='car-item-name {0}'>{1}</p>", activeClass, translationHelper.getTranslation("_mainSearchAtvsText", languageId)));
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("</a>");

            sb.Append("</div>");

            sb.Append("<div class='col-md-4 col-sm-6 col-xs-12 no-padding'>");
            sb.Append(String.Format("<a href='{0}'>", translationHelper.getTranslation("_mainSearchFiltronDimensions", languageId)));
            activeClass = String.Empty;
            if (GlobalConsts.SIZES_IDS.Contains(pageId))
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-dimensions dimension-back-2 wow fadeInRight'>");
                activeClass = "car-item-name-active";
            }   //if
            else
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-dimensions dimension-back-1 wow fadeInRight'>");
            }   //else
            sb.Append("<div class='category-select  '>");
            sb.Append(String.Format("<p class='car-item-name {0}'>{1}</p>", activeClass, translationHelper.getTranslation("_mainSearchDimensionsText", languageId)));
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("</a>");

            sb.Append(String.Format("<a href='{0}'>", translationHelper.getTranslation("_mainSearchFiltronCrossList", languageId)));
            activeClass = String.Empty;
            if (GlobalConsts.CROSSLIST_IDS.Contains(pageId))
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-cross cross-back-2 wow fadeInRight'>");
                activeClass = "car-item-name-active";
            }   //if
            else
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-cross cross-back-1 wow fadeInRight'>");
            }   //else
            sb.Append("<div class='category-select  '>");
            sb.Append(String.Format("<p class='car-item-name {0}'>{1}</p>", activeClass, translationHelper.getTranslation("_mainSearchCrosslistText", languageId)));
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("</a>");

            sb.Append(String.Format("<a href='{0}'>", translationHelper.getTranslation("_mainSearchFiltronLPG", languageId)));
            activeClass = String.Empty;
            if (GlobalConsts.LPG_IDS.Contains(pageId))
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-lpg lpg-back-2 wow fadeInRight'>");
                activeClass = "car-item-name-active";
            }   //if
            else
            {
                sb.Append("<div class='col-xs-4 cat-item no-padding option-lpg lpg-back-1 wow fadeInRight'>");
            }   //else
            sb.Append("<div class='category-select  '>");
            sb.Append(String.Format("<p class='car-item-name {0}'>{1}</p>", activeClass, translationHelper.getTranslation("_mainSearchLPGText", languageId)));
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("</a>");
            
            sb.Append("</div>");

            sb.Append("</div>");

            return sb.ToString();
        }

        

    }
}
